package com.dk.controller;


import com.dk.service.ReportService;
import com.dk.vo.ReportVO;
import com.dongdongshop.data.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author wbh
 * @since 2023-03-22
 */
@RestController
@RequestMapping("report")
public class ReportController {

    @Autowired
    private ReportService reportService;


    @GetMapping("getInfoList")
    public Result getInfoList(ReportVO reportVO) {
        List<ReportVO> reportVOList = reportService.getInfoList(reportVO);
        return Result.OK().setData(reportVOList);
    }

    @PostMapping("insertInfoReport")
    public Result insertInfoReport(ReportVO reportVO) {
        reportService.insertInfoReport(reportVO);
        return Result.OK();
    }

    @GetMapping("getInfoReportById")
    public Result getInfoReportById(Integer id) {
        ReportVO reportVO = reportService.getInfoReportById(id);
        return Result.OK().setData(reportVO);
    }

    @PostMapping("updateInfoReportById")
    public Result updateInfoReportById(ReportVO reportVO) {
        reportService.updateInfoReportById(reportVO);
        return Result.OK();
    }

    @PostMapping("deleteInfoReportById")
    public Result deleteInfoReportById(Integer id) {
        reportService.deleteInfoReportById(id);
        return Result.OK();
    }

}

